Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prolog tree-sitter grammar #11611

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mkorje
Copy link

@mkorje mkorje commented Aug 31, 2024

This PR adds a tree-sitter grammar for Prolog. It uses https://codeberg.org/foxy/tree-sitter-prolog, a fork/rewrite of https://github.com/Rukiza/tree-sitter-prolog.

I've probably made a mistake in how the runtime/queries/prolog/* files should be done, sorry about that! The changes in this PR seem to be working for me, though I'd appreciate it if others could try it out and ensure it works for them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The captures need some tweaks to match the scopes we use: https://docs.helix-editor.com/master/themes.html#syntax-highlighting

For example boolean should be constant.builtin.boolean, number should be constant.numeric.integer or constant.numeric.float

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are written for neovim's indentation system. Ours has different captures: https://docs.helix-editor.com/master/guides/indent.html

We could remove this file to use the default indentation and indents queries could be contributed as a follow-up

@the-mikedavis the-mikedavis added the A-language-support Area: Support for programming/text languages label Sep 1, 2024
@gruhn
Copy link
Contributor

gruhn commented Sep 13, 2024

I think there is a problem with multi-line comments, but that's probably a problem with the grammar, right? For example, the following code is highlighted like one big comment:

/* first comment */

plus(X, Y, Z) :- 
	Z is X + Y.

/* second comment */

Although, if I remove the second comment, then the predicate plus is not highlighted like a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants